package com.yxt.qmgf.start.sql;

import com.yxt.qmgf.start.vo.LoginVO;
import com.yxt.qmgf.userinfo.vo.UserInfoVO;
import org.apache.ibatis.annotations.Param;


public class LoginSQLProvider {
    public String verifySelect(@Param("username") String username){
            return "SELECT * FROM users WHERE username = #{username}";
    }
    public String Delete(@Param("uid") String uid){
        return "DELETE FROM users WHERE uid = #{uid}";
    }
    public String Insert(@Param("vo") LoginVO vo) {
        return "INSERT INTO users (username, password, code, name, uid) " +
                "VALUES (#{vo.username}, #{vo.password}, #{vo.code}, #{vo.name}, #{vo.uid})";
    }
    public String SelectCount() {
        return "SELECT COUNT(*) FROM users";
    }


    public String SelectByUid(@Param("uid") String uid){
        return "SELECT * FROM user_info WHERE uid = #{uid}";
    }
    public String DeleteByUid(@Param("uid") String uid){
        return "DELETE FROM user_info WHERE uid = #{uid}";
    }
    public String UpdateByVo(@Param("uvo")UserInfoVO uvo){ return "UPDATE user_info SET username = #{uvo.username}, name = #{uvo.name}, sex = #{uvo.sex}, code = #{uvo.code}, score = #{uvo.score}, email = #{uvo.email}, telNumber = #{uvo.telNumber}, title = #{uvo.title}, game = #{uvo.game} WHERE uid = #{uvo.uid}";}
    public String InsertByVo(@Param("uvo") UserInfoVO uvo) {
        return "INSERT INTO user_info (uid, username, name, sex, code, score, email, telNumber, title, game) " +
                "VALUES (#{uvo.uid}, #{uvo.username}, #{uvo.name}, #{uvo.sex}, #{uvo.code}, #{uvo.score}, #{uvo.email}, #{uvo.telNumber}, #{uvo.title}, #{uvo.game})";
    }
}
